package cn.schoolwow.quickdao.module.database.dml.instance.service.insert;

import cn.schoolwow.quickdao.module.database.dml.instance.flow.common.SetGenerateKeysFlow;
import cn.schoolwow.quickdao.module.database.dml.instance.flow.common.SetInstanceEntityFlow;
import cn.schoolwow.quickdao.module.database.dml.instance.flow.insert.common.SetInsertInstanceParameterFlow;
import cn.schoolwow.quickdao.module.database.dml.instance.flow.insert.common.SetInsertInstanceStatementFlow;
import cn.schoolwow.quickdao.module.database.parent.flow.executor.ExecuteUpdateConnectionFlow;
import cn.schoolwow.quickflow.QuickFlowExecutor;
import cn.schoolwow.quickflow.flow.CompositeBusinessFlow;

public class InsertInstanceCompositeBusiness implements CompositeBusinessFlow {
    @Override
    public void executeCompositeBusiness(QuickFlowExecutor quickFlowExecutor) {
        quickFlowExecutor.next(new SetInstanceEntityFlow())
                .next(new SetInsertInstanceStatementFlow())
                .next(new SetInsertInstanceParameterFlow())
                .putTemporaryData("name", "插入实例")
                .next(new ExecuteUpdateConnectionFlow())
                .next(new SetGenerateKeysFlow());
    }

    @Override
    public String name() {
        return "插入实例";
    }

}
